/*
 * @Description: 路由模块
 * @Author: 小雨
 * @Date: 2024-06-28 11:31:59
 * @LastEditTime: 2024-06-28 14:51:09
 * @LastEditors: 小雨
 */
const express = require('express');

const router = express.Router();

router.get('/get', (req, res) => {
    const query = req.query;
    res.send({
        status: 0,
        msg: 'get成功',
        data: query,
    });
});

//req.body需要使用中间件express.urlencoded进行解析
router.post('/post', (req, res) => {
    const body = req.body;
    res.send({
        status: 0,
        msg: 'get成功',
        data: body,
    });
});

//会发送两次请求 第一次预检请求不会有ip
router.delete('/delete', (req, res) => {
    res.send({
        status: 0,
        msg: 'delete成功',
    });
});

module.exports = router;
